<template>
  <BasicTable @register="registerTable"></BasicTable>
  <InfoModal ref="modalRef"></InfoModal>
</template>

<script lang="ts" setup>
/* eslint-disable no-use-before-define */
import BasicTable from '/@/components/BasicTable/BasicTable.vue';
import { useBasicTable } from '/@/components/BasicTable/hooks/useBasicTable';
import { ref } from 'vue';
import { columns, searchFormSchema } from '/@/views/system-mgmt/app-domain-mgmt/data';
import InfoModal from '/@/views/system-mgmt/app-domain-mgmt/infoModal.vue';
import { queryTenantAppDomain } from '/@/api/system-mgmt/appDomain/appDomain';
import { checkPowerByName } from '/@/utils/permission';

const modalRef = ref();

const handleView = (record: Recordable) => {
  modalRef.value.showModal(record);
};
const [registerTable] = useBasicTable({
  api: queryTenantAppDomain,
  columns: columns,
  immediate: true,
  useSearchForm: true,
  usePagination: true,
  formConfig: {
    labelWidth: 100,
    schemas: searchFormSchema,
  },
  actionColumns: [
    {
      name: '查看详情',
      click: handleView,
      ifShow: checkPowerByName('detail'),
      props: {
        style: { color: '#447b9c', fontWeight: 'bolder', backgroundColor: '' },
      },
    },
  ],
});
</script>
